﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;


namespace DoAn
{
    public partial class frSuaThongTinKhachHang : Form
    {
        public frSuaThongTinKhachHang()
        {
            InitializeComponent();
        }

           public frSuaThongTinKhachHang(string MaKH)
            : this()
        {
            KhachHangDTO khDTO = new KhachHangDTO();
            KhachHangBUS khBUS = new KhachHangBUS();           
            khDTO = khBUS.LayKhachTheoMa(MaKH);          
            lbMaKH.Text = khDTO.MaKH;     
            txtTenKH.Text = khDTO.TenKH;
            txtTenCongTy.Text = khDTO.TenCongTy;      
            txtMaSoThue.Text = khDTO.MaSoThue;        
            txtDiaChi.Text = khDTO.DiaChi;
            txtDienThoai.Text = khDTO.DienThoai;
            txtFax.Text = khDTO.Fax;
            txtEmail.Text = khDTO.Email;
            
        }

        private void bttLuu_Click(object sender, EventArgs e)
        {
            KhachHangDTO khDTO = new KhachHangDTO();
            khDTO.MaKH = lbMaKH.Text;
            khDTO.TenKH = txtTenKH.Text.Trim();
            khDTO.TenCongTy = txtTenCongTy.Text.Trim();
            khDTO.MaSoThue = txtMaSoThue.Text.Trim();
            khDTO.DiaChi = txtDiaChi.Text.Trim();
            khDTO.DienThoai = txtDienThoai.Text.Trim();
            khDTO.Fax = txtFax.Text.Trim();
            khDTO.Email = txtEmail.Text.Trim();
            KhachHangBUS khBUS = new KhachHangBUS();
            khBUS.SuaThongTinKhachHang(khDTO);
            Close();
        }

        private void bttHuy_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void frSuaThongTinKhachHang_Load(object sender, EventArgs e)
        {

        }
    }
}
